﻿<shared:UserControlBase x:Class="HP.Cachalote.WPF.UserControls.DueTimePickerUserControl"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             xmlns:shared="clr-namespace:HP.Cachalote.WPF.Shared"
             xmlns:xctk="http://schemas.xceed.com/wpf/xaml/toolkit" 
             mc:Ignorable="d"
             d:DesignHeight="300" d:DesignWidth="300">
    <UserControl.Resources>
        <ResourceDictionary>
            <Style x:Key="DueTimePickerContainer" TargetType="{x:Type StackPanel}">
                <Style.Triggers>
                    <DataTrigger Binding="{Binding IsAllDayEvent}" Value="True">
                        <Setter Property="Visibility" Value="Collapsed" />
                    </DataTrigger>
                </Style.Triggers>
            </Style>
        </ResourceDictionary>
    </UserControl.Resources>
    <Grid Margin="10">
        <Grid.ColumnDefinitions>
            <!-- Start Time -->
            <ColumnDefinition Width="185" />
            <!-- Separator -->
            <ColumnDefinition />
            <!-- End Time -->
            <ColumnDefinition Width="185" />
        </Grid.ColumnDefinitions>
        <Grid.RowDefinitions>
            <!-- TodoItem Title -->
            <RowDefinition Height="Auto" />
            <!-- Separator -->
            <RowDefinition Height="14" />
            <!-- Due Date -->
            <RowDefinition Height="Auto" />
            <!-- Separator -->
            <RowDefinition Height="10" />
            <!-- Start Time & End Time -->
            <RowDefinition Height="Auto" />
            <RowDefinition Height="10" />
            <!-- Okay & Cancel Buttons -->
            <RowDefinition Height="Auto" />
        </Grid.RowDefinitions>
        <TextBlock Grid.ColumnSpan="3" Text="{Binding TodoItemTitle}" Style="{StaticResource TodoItemTitleTextBlock}" />
        <StackPanel Grid.Row="2" Orientation="Horizontal">
            <TextBlock Text="Due Date" Margin="0,4,4,0" />
            <DatePicker SelectedDate="{Binding DueDate}" />
        </StackPanel>
        <CheckBox Grid.Row="2" Grid.Column="2" Style="{StaticResource RegularCheckBoxStyle}" IsChecked="{Binding IsAllDayEvent}" VerticalContentAlignment="Center" Content="All Day Event" />
        <StackPanel Style="{StaticResource DueTimePickerContainer}" Grid.Row="4" Orientation="Horizontal">
            <CheckBox Style="{StaticResource RegularCheckBoxStyle}" Content="Start Time" VerticalContentAlignment="Center" IsChecked="{Binding IsStartTimeSpecified}" />
            <xctk:TimePicker Margin="14,0,0,0" Format="Custom" FormatString="HH:mm" Value="{Binding StartTime}" IsEnabled="{Binding IsStartTimeSpecified}" />
        </StackPanel>
        <StackPanel Style="{StaticResource DueTimePickerContainer}" Grid.Row="4" Grid.Column="2" Orientation="Horizontal">
            <CheckBox Style="{StaticResource RegularCheckBoxStyle}" Content="End Time" VerticalContentAlignment="Center" IsChecked="{Binding IsEndTimeSpecified}" />
            <xctk:TimePicker Margin="12,0,0,0" Format="Custom" FormatString="HH:mm" Value="{Binding EndTime}" IsEnabled="{Binding IsEndTimeSpecified}" />
        </StackPanel>
        <Button Grid.Row="6" HorizontalAlignment="Right" Content="OK" IsDefault="True" Command="{Binding OkCommand}" Width="80" Height="35" />
        <Button Grid.Row="6" Grid.Column="2" HorizontalAlignment="Left" Content="Cancel" IsCancel="True" Command="{Binding CancelCommand}" Width="80" Height="35" />
    </Grid>
</shared:UserControlBase>
